package 网易机试;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class 第一题 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(func(s));
        }
        sc.close();
    }

    private static int func(String s) {
        if (s.length() == 1)
            return 1;

        if (s.replaceAll("[1]+", "").length() == s.length())
            return 1;

        if (s.replaceAll("[0]+", "").length() == s.length())
            return 1;

        int len1 = 0;
        Matcher m1 = Pattern.compile("([1][0])+[1]").matcher(s);
        while (m1.find())
            len1 = Math.max(len1, m1.group().length());

        int len2 = 0;
        Matcher m2 = Pattern.compile("([0][1])+[0]").matcher(s);
        while (m2.find())
            len2 = Math.max(len2, m2.group().length());

        int len3 = 0;
        Matcher m3 = Pattern.compile("([1][0])+").matcher(s);
        while (m3.find())
            len3 = Math.max(len3, m3.group().length());

        int len4 = 0;
        Matcher m4 = Pattern.compile("([0][1])+").matcher(s);
        while (m4.find())
            len4 = Math.max(len4, m4.group().length());

        return Math.max(Math.max(len1, len2), Math.max(len3, len4));
    }
}
